class Solution(object):
    def twoSum(nums,target):
        """这样写更直观，遍历列表同时查字典"""
        dct = {}
        for i, n in enumerate(nums):
            cp = int(target) - int(n)
            if cp in dct:
                return [dct[cp],i]
            else:
                dct[n] = i



    if __name__=="__main__":
        num = input()
        target = input()
        a=[]
        b=num[1:-1]
        b=b.split(",")
        for i in b:
            a.append(int(i))

        print(twoSum(a,target))